<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<%@taglib tagdir="/WEB-INF/tags" prefix="util" %>

<jsp:include page="../fragments/header.jsp">
	<jsp:param name="title" value="Order [${order.id}]" />
</jsp:include>

<div class="form-horizontal">
	<div class="form-group">
		<label class="label"><b>Taxes</b></label>
		<label class="data">${order.taxes}</label>
	</div>
	<div class="form-group">
		<label class="label"><b>Shipping Fees</b></label>
		<label class="data">${order.shippingFees}</label>
	</div>
	<div class="form-group">
		<label class="label"><b>Sub-Total Price</b></label>
		<label class="data">${order.subTotalPrice}</label>
	</div>
	<div class="form-group">
		<label class="label"><b>Grand-Total Price</b></label>
		<label class="data">${order.grandTotalPrice}</label>
	</div>
	<div class="form-group">
		<label class="label"><b>Status</b></label>
		<label class="data">${order.status.friendlyName}</label>
	</div>
	<div class="form-group">
		<label class="label"><b>Created By</b></label>
		<label class="data">${order.creator.username}</label>
	</div>
	<div class="form-group">
		<label class="label"><b>Created On</b></label>
		<label class="data"><fmt:formatDate value="${order.date.time}" type="date" dateStyle="long" /></label>
	</div>
	<div class="form-group">
		<label class="label"><b>Order Items</b></label>
		<span class="data">
			<c:forEach var="orderItem" items="${order.orderItems}">
				${orderItem}<br />
			</c:forEach>
		</span>
	</div>

	<c:if test="${not empty toStatus}">
		<c:forEach var="status" items="${toStatus}">
			<util:change-status
				url="${pageContext.request.contextPath}/so_status"
				order_id="${order.id}" from="${order.status}" to="${status}"
				text="Set as <b>${status.friendlyName}</b>" styleClass="btn-block" />
		</c:forEach>
	</c:if>
</div>

<br />
<br />

<form action="${pageContext.request.contextPath}/so_list_back">
	<button class="btn btn-default">
		<b>Back to Orders List</b>
	</button>
</form>

<jsp:include page="../fragments/footer.jsp" />